How to store media using the Sequence Collections API with Cloudflare Workers, as well as read from the Metadata API to render images.
Secret API
Key must be obtained to authenticate requests to your project
First start by accessing settings, and selecting the API Keys from the Sequence Builder Console
+ Add Admin API Secret Key
write
and confirm by pressing + Add API Secret Key
copy
the key and store it in your wrangler.toml
as JWT_ACCESS_KEY
, as you will not have access to this in the future from the Sequence Builder Console.
Secret API Key
and projectID
retrieved from the Builder Console
We call the service to retrieve a collectionID
collectionID
from the returned response in the wrangler.toml
as COLLECTION_ID
node_compat = true
to your wrangler.toml
to allow the window object to be available to the @0xsequence/metadata
packageSequenceCollections
with pnpm install @0xsequence/metadata
metadadaField
(assetType) to image
, with the other necessary fields completed to return an asset response to be used in the next step
asset.id
from the previous jsonCreateAsset
object
uploadAssetRes.url
is the media file url living on Sequence servers
private
boolean to false
projectID
and collectionID
by running the following command
false
accessible publicly, while others remain hidden until changed
<file_name>
will be image.png
baseURI
of an ERC721
or ERC1155
you would write to a smart contract setBaseMetadataURI
the following URI
tokenID
to the end
Give it a try
metadata_field
is set to image